<%@ page language="java" contentType="text/html; charset=utf-8" import="java.util.*,com.zh.tea.service.impl.*,com.zh.tea.service.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>茶商后台管理</title>
  <link rel="stylesheet" href="/tea/admin/layui-v2.4.3/layui/css/layui.css"  media="all">
</head>
<script src="/tea/admin/layui-v2.4.3/layui/layui.js"></script>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">醉品茶城</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
     <li class="layui-nav-item"><a href="ShowUser.jsp">用户信息</a></li>
      <li class="layui-nav-item"><a href="ShowGoods.jsp">商品信息</a></li>
      <li class="layui-nav-item"><a href="ShowOrder.jsp">订单信息</a></li>
      <li class="layui-nav-item">
        <a href="javascript:;">其它系统</a>
        <dl class="layui-nav-child">
          <dd><a href="">邮件管理</a></dd>
          <dd><a href="">消息管理</a></dd>
          <dd><a href="">授权管理</a></dd>
        </dl>
      </li>
    </ul>

    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          用户名
        </a>
      </li>
      <li class="layui-nav-item"><a href="">退出</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-nav-itemed">
          <a class="" href="javascript:;">用户管理</a>
          <dl class="layui-nav-child">
            <dd><a href="userUpdate.jsp">用户修改</a></dd>
            <dd><a href="userDel.jsp">用户删除</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">订单管理</a>
          <dl class="layui-nav-child">
            <dd><a href="OrderUpdate.jsp">订单修改</a></dd>
            <dd><a href="OrderDel.jsp">订单删除</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
        <a href="javascript:;">商品管理</a>
          <dl class="layui-nav-child">
            <dd><a href="<%=request.getContextPath()%>/TypeServlet">商品增加</a></dd>
            <dd><a href="GoodsDel.jsp">商品操作</a></dd>
          </dl>
        </li>
        <li class="layui-nav-item">
          <a href="javascript:;">新闻管理</a>
          <dl class="layui-nav-child">
            <dd><a href="NewsInsert.jsp">新闻增加</a></dd>
          <dd><a href="NewsUpdateAndDelete.jsp">新闻操作</a></dd>          
          </dl>
        </li>
         <li class="layui-nav-item">
        <a href="javascript:;">反馈信息</a>
         <dl class="layui-nav-child">
            <dd><a href="FeedbackShowAndDelete.jsp">反馈查看和删除</a></dd>          
          </dl>
        </li>
      </ul>
    </div>
  </div>
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
      <table class="layui-hide" id="test" lay-filter="test"></table>
    </div>
  </div>
    <!-- 底部区域 -->
  <div class="layui-footer" style="text-align:center">
    © chachegn.com - 醉品商城
  </div>
</div>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
//JavaScript代码区域：左侧的下拉列表
layui.use('element', function(){
  var element = layui.element;
});


layui.use('table', function(){
	  var table = layui.table;
	  
	  table.render({
	    elem: '#test'
	    ,url:'../TeaServlet?opt=showAll'
	    ,toolbar: '#toolbarDemo'
	    ,title: '用户数据表'
	    ,cols: [[
	    
	      {field:'teano', width:100, title: '茶品编号'}
	      ,{field:'name', width:80, title: '茶名'}
	      ,{field:'price', width:80, title: '价格'}
	      ,{field:'stock', width:80, title: '库存'}
	      ,{field:'spec', title: '茶叶规格', minWidth: 150}
	      ,{field:'packspec', width:100, title: '包装工艺'}
	      ,{field:'licenseno', width:100, title: '许可证号'}
	      ,{field:'teach', width:100, title: '制作工艺'}
	      ,{field:'proloc', width:75, title: '产地'}
	      ,{field:'producedate', width:130, title: '生产日期'}
	      ,{field:'bzp', width:100, title: '保质期'}
	      ,{field:'typeid', width:80, title: '品种id'}
	      ,{field:'brandid', width:80, title: '品牌id'}
	      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
	    ]]
	    ,page: true
	  });
	  //监听行工具事件
	  table.on('tool(test)', function(obj){
	    var data = obj.data;
	    /* url:'../TeaServlet?opt=delete' */
	    //console.log(obj)
	    if(obj.event == 'del'){
	      layer.confirm('真的删除行么', {icon:3, title:'系统提示', btn: ['确定', '取消']},function(index){
	    	var count=data.teano;
	 		location.href='../TeaServlet?opt=delete&teano='+count;
	        layer.close(index);  
	      });
	    }else if(obj.event === 'edit'){
	    	layer.confirm('确定修改吗',{icon:3,title:'系统提示',btn:['确定','取消']}, function(index){
	    	       var count = data.teano;
	    	       location.href='../TeaServlet?opt=sel1&teano='+count;
	    	        layer.close(index);
	      });
	    }
	      });
	});
</script>
</body>
</html>